package cn.sytton.taffe.framework.util;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * ResponseWriter工具类
 *
 * @author skyrock
 */
@Slf4j
public class ResponseWriter {
    public static void print(HttpServletResponse response, int code, String content) {
        try {
            response.setStatus(code);
            response.setContentType("application/json");
            response.setCharacterEncoding("utf-8");
            response.getWriter().print(content);
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
    }
}
